
#ifndef TOKENDATA_H
#define TOKENDATA_H

#include <map>
#include <string>

namespace mjc {

	struct TokenType 
	{
		enum Type
		{
			T_NONE,
			T_IDENT,
			T_NUMBER,
			T_CHAR,
			T_PLUS,
			T_MINUS,
			T_TIMES,
			T_SLASH,
			T_REM,
			T_EQL,
			T_NEQ,
			T_LSS,
			T_LEQ,
			T_GTR,
			T_GEQ,
			T_ASSIGN,
			T_SEMICOLON,
			T_COMMA,
			T_PERIOD,
			T_LPAR,
			T_RPAR,
			T_LBRACK,
			T_RBRACK,
			T_LBRACE,
			T_RBRACE,
			T_CLASS,
			T_ELSE,
			T_FINAL,
			T_IF,
			T_NEW,
			T_PRINT,
			T_PROGRAM,
			T_READ,
			T_RETURN,
			T_VOID,
			T_WHILE,
			T_EOF
		};

		bool operator () (const Type& t0, const Type& t1) const
		{
			return t0 < t1;
		}
	};

	//Data store for token information like names and keywords. Its a read-only singleton
	class TokenData
	{
	private:
		TokenData() {}
		TokenData(const TokenData&) {}

		typedef std::map <TokenType::Type, std::wstring, TokenType> mapTypeString;
		typedef std::map <std::wstring, TokenType::Type> mapStringType;

		static mapTypeString tokenName;
		static mapStringType keywords;

	public:
		static void Initialize();
		static bool GetTokenName(const TokenType::Type& type, std::wstring& name);
		static bool GetKeywordToken(const std::wstring& keyword, TokenType::Type& type);
	};

}

#endif